﻿using SalesSys.Comm.DAL;
using SalesSys.DAL.Base;
using SalesSys.DAL.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SalesSys.DAL
{
    public class CustomerBalanceRecord : DbEntityBase<Guid>
    {
        public CustomerBalanceRecord()
        {
            
        }
        /// <summary>
        /// 客户经理
        /// </summary>
        public Guid EmployeeId { get; set; }
        /// <summary>
        /// 客户
        /// </summary>
        public Guid CustomerId { get; set; }
        /// <summary>
        /// 户头
        /// </summary>
        public Guid AccountId { get; set; }
        /// <summary>
        /// 变动前余额
        /// </summary>
        public decimal BeforeBalance { get; set; }
        /// <summary>
        /// 变动后余额
        /// </summary>
        public decimal AfterBalance { get; set; }
        /// <summary>
        /// 变动余额
        /// </summary>
        public decimal ChangeBalance { get; set; }
        /// <summary>
        /// 变动时间
        /// </summary>
        public DateTime ChangeTime { get; set; }
        /// <summary>
        /// 变动原因
        /// </summary>
        public string ChangeResult { get; set; }
        /// <summary>
        /// 关联编号
        /// </summary>
        public Guid? HandlerId { get; set; }
        /// <summary>
        /// 操作实体的ID，比如如果是锁价单，那么该字段代表锁价单ID
        /// </summary>
        public string SourceTag { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        public class Mapper : SalMapper<CustomerBalanceRecord, Guid>
        {
            public Mapper()
            {
                Property(p => p.EmployeeId); 
                Property(p => p.CustomerId); 
                Property(p => p.AccountId);
                Property(p => p.HandlerId);
                Property(p => p.ChangeResult);
                Property(p => p.ChangeTime);
                Property(p => p.ChangeBalance);
                Property(p => p.BeforeBalance);
                Property(p => p.AfterBalance);
                Property(p => p.SourceTag);
                Property(p => p.Remark);
            }
        }
    }
}
